package com.yixing.tech.wms.controller;

import com.yixing.tech.common.base.BaseControl;
import com.yixing.tech.common.base.BusinessException;
import com.yixing.tech.common.base.Rs;
import com.yixing.tech.wms.param.ProductInByContainerParam;
import com.yixing.tech.wms.service.ProductInStockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 成品入库
 *
 * @author yixing tech
 * @since 1.0.0
 */
@RestController
@CrossOrigin
@RequestMapping(value = "/production/inStock")
public class ProductInStockController extends BaseControl {

    @Autowired
    private ProductInStockService productInStockService;

    /**
     * 执行入库
     */
    @PostMapping("/execution/in/container")
    public Rs<Object> executionInByLocation(@RequestBody ProductInByContainerParam param) throws BusinessException {
        return Rs.ok(productInStockService.executionInByContainer(param.getContainerCode()));
    }

    /**
     * 上报Erp
     */
    @PostMapping("/report/erp/{dtlId}")
    public Rs<Object> reportErp(@PathVariable("dtlId") String dtlId) throws BusinessException {
        return Rs.ok(productInStockService.reportErp(dtlId));
    }

}
